package com.yearner.reviewplan.plan.model;

import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author pengyg
 * @since 2020/2/26
 */
@Getter
@Setter
public class PlanVo {
    private String planId;
    /** 当前所处阶段 */
    private int stageIndex;
    private String title;
    private String detail;
    private List<String> tag;
    /** 详情-Markdown  */
    private String detailMd;
    private String question;
    private List<Question> questionList;

    private long lastTime;
    public PlanVo(){}
    public PlanVo(Plan plan){
        this.planId = plan.getPlanId().toString();
        this.title = plan.getTitle();
        this.detail = plan.getDetail();
        this.detailMd = plan.getDetailMd();
        this.question = plan.getQuestion();
        this.questionList = plan.getQuestionList();
        this.lastTime = plan.getLastTime();
        this.stageIndex = plan.getStageIndex();
        this.tag = plan.getTag() == null ? new ArrayList<>() : JSON.parseArray(plan.getTag(),String.class);
    }

}
